#include <47func.h>
#include <openssl/md5.h> // sudo apt install libssl1.1-dev
int main(int argc, char *argv[])
{
    int fd = open("file1", O_RDONLY);
    char buf[4096];
    MD5_CTX ctx;
    MD5_Init(&ctx);
    while(1){
        bzero(buf,4096);
        ssize_t sret = read(fd,buf,4096);
        MD5_Update(&ctx,buf,sret);
        if(sret == 0){
            break;
        }
    }
    unsigned char md[16];//申请16个字节
    MD5_Final(md,&ctx);
    for(int i = 0; i < 16; ++i){
        printf("%02x",md[i]);
    }
    printf("\n");
    return 0;
}

